package org.gwc.spring_03;

import org.springframework.beans.factory.FactoryBean;

public class StaffFactoryBean implements FactoryBean<Staff> {

    private String name;

    public void setName(String name) {
        this.name = name;
    }

    @Override
    public Staff getObject() throws Exception {
        // 内部进行复杂的对象构建过程
        Staff staff = new Staff();
        // 这里委婉的给实例对象赋值
        staff.setName(this.name);
        return staff;
    }

    /**
     * 返回对象实例类型
     * @return
     */
    @Override
    public Class<?> getObjectType() {
        return Staff.class;
    }
}
